<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>


<div id="app">
  <input type="text" v-model="content">
  <button @click="createTodo">add</button>
  <ul>
    <li v-for="item in todos">{{ item }}</li>
  </ul>
</div>


<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>

  const app = new Vue({
    el: '#app',
    data: {
      content: '',
      todos: []
    },
    methods: {
      createTodo() {
        // console.log(this.content)
        this.todos.push(this.content)
        this.content = ''
      }
    }
  })

</script>

<!--
数据驱动
-->

</body>
</html>
